<template>
    <div class="login">
      <el-form :rules="rules" ref="loginForm" :model="loginForm" class="loginContainer">
        <h3 class="loginTitle">莫比乌斯商城登录</h3>
        <el-form-item prop="username">
          <el-input type="text" auto-complete="false" v-model="loginForm.username" placeholder="请输入用户名"></el-input>
        </el-form-item>
        <el-form-item prop="password">
          <el-input type="password" auto-complete="false" v-model="loginForm.password" placeholder="请输入密码"></el-input>
        </el-form-item>
        <el-form-item>
          <span class="logintext" @click="register"><a>切换登录方式</a></span>
        </el-form-item>
        <el-checkbox v-model="checked" class="loginRemember">记住我</el-checkbox>
        <el-button type="primary" style="width:100%" @click="submitLogin">登录</el-button>
      </el-form>
    </div>
  </template>
  
  <script>
  
  export default {
    name: "login",
    data(){
      return{
        /* 登录用户表单信息 */
        loginForm:{
          username:'1313456',
          password:'123',
          phone:'18965043789'
        },
        /* 登录用户表单验证规则 */
        rules:{
          username: [{required:true,message:'请输入用户名',trigger:'blur'}],
          password: [{required:true,message:'请输入密码',trigger:'blur'}]
        },
        /* 记住我按钮 */
        checked:true,
      }
    },
    methods:{
      /* 注册组件跳转 */
      register(){
        this.$router.push('/register')
      },
      /* 登录功能 */
      submitLogin(){
        this.$message({
          message: '登录成功',
          type: 'success'
        });
        this.$router.push('/shop')
      }
    }
  }
  </script>
  
  <style scoped>
  .login{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 790px;
    background-image: url("../img/1.jpg");
    background-size: cover;
    margin-top: -50px;
  }
  .loginContainer{
    border-radius: 15px;
    background-clip: padding-box;
    opacity: 0.9;
    width: 350px;
    padding: 15px 35px 15px 35px;
    background: #fff;
    border: 1px solid #eaeaea;
    box-shadow: 0 0 25px #cac6c6;
    opacity: 0.75;
  }
  .loginTitle{
    margin: 0 auto 40px auto;
    text-align: center;
    color:rgb(23, 73, 92);
  }
  .logintext{
    float: right;
    color: #f58192;
    text-decoration-line: none;
    cursor: pointer;
  }
  .loginRemember{
    float: left;
    margin: 0 0 15px 0;
  }
  </style>
  